package com.csu.service;

import com.csu.common.CommonResponse;
import com.csu.persistence.AdminDao;
import com.csu.domain.Admin;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@MapperScan("com.csu.persistence")
public class AdminService {
    @Autowired
    private AdminDao adminDao;

    public CommonResponse<Object> login(Admin admin) {
        if (adminDao.selectByUsernameAndPassword(admin) != null)
            return CommonResponse.createForSuccess("200", "登录成功");

        else return CommonResponse.createForError("用户名或密码错误");

    }


}
